package com.tuo51.evaluate.controller;


import com.tuo51.evaluate.vo.BmiVo;
import com.tuo51.foudation.model.StatusResponse;
import com.tuo51.foudation.utils.export.HealthReportUtil;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import static org.springframework.web.bind.annotation.RequestMethod.POST;


@RestController
@RequestMapping("/eapi/bmi")
@Api(value = "/eapi/bmi", tags = "测评 - 健康相关")
public class EvaluateHealthyController {

    @RequestMapping(value = "/info", method = POST)
    public StatusResponse bmiInfo(@RequestParam(name = "name", required = false) String name,
                                         @RequestParam(name = "gender", required = true) Integer gender,
                                         @RequestParam(name = "birthday", required = false) String birthday,
                                         @RequestParam(name = "weight", required = false) String weight,
                                         @RequestParam(name = "height", required = false) String height
                                         ){


        return StatusResponse.success(HealthReportUtil.bmiInfo(name, gender, birthday, weight, height));
    }



    @RequestMapping(value = "/info1", method = POST)
    public StatusResponse bmiInfo1(@RequestBody BmiVo vo
    ){


        return StatusResponse.success(HealthReportUtil.bmiInfo(vo.getName(), vo.getGender(), vo.getBirthday(), vo.getWeight(), vo.getHeight()));
    }


}
